//
//  WedPullCollectionViewCell.m
//  MMLOOK
//
//  Created by dllo on 15/9/28.
//  Copyright © 2015年 武俊娥. All rights reserved.
//

#import "WedPullCollectionViewCell.h"

#import "WedModel.h"

#import "UIImageView+WebCache.h"

@interface WedPullCollectionViewCell ()

@property(nonatomic, retain)UIImageView *imageView;
@property(nonatomic, retain)UILabel *PriceLabel;
@property(nonatomic, retain)UILabel *likeCount;

@end

@implementation WedPullCollectionViewCell

-(void)dealloc
{
    [_imageView release];
    [_PriceLabel release];
    [_likeCount release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.imageView = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imageView];
        [_imageView release];
        
        self.PriceLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.PriceLabel];
        [_PriceLabel release];
        
        self.likeCount = [[UILabel alloc]init] ;
        self.likeCount.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:self.likeCount];
        [_likeCount release];
    }
    
    return self;
}



-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    
    self.imageView.frame = CGRectMake(0, 0, self.frame.size.width,  self.frame.size.height - 20);
    
    self.PriceLabel.frame = CGRectMake(0, self.imageView.frame.size.height, self.frame.size.width / 2, 20);
    
    self.likeCount.frame = CGRectMake(self.frame.size.width / 2, self.imageView.frame.size.height, self.frame.size.width / 2, 20);
    
}



-(void)sendNameId:(WedModel *)model
{
    
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:model.photo_path] placeholderImage:[UIImage imageNamed:@"home.jpg"]];
    
    self.PriceLabel.text = [NSString stringWithFormat:@"￥%@",[model.price stringValue]];
    self.likeCount.text = [NSString stringWithFormat:@"⭐️%@",[model.like_count stringValue]];
    
}




@end
